#ifndef __REFLOAT_OPERATORS__
#define __REFLOAT_OPERATORS__

#include "refloat.h"

inline refloat& refloat::operator =(const refloat& b)
{
  if( mpfr_get_prec(b.value) != mpfr_get_prec(value) )
  {
    this->set_prec(mpfr_get_prec(b.value));
  }
  this->set(b);
  
  return *this;
}


inline refloat refloat::operator +(const refloat& b) const
{
  refloat temp(0, mpfr_get_prec(value), true);
  temp.set(*this);
  temp.add(b);
  return temp;
}


inline refloat refloat::operator -(const refloat& b) const
{
  refloat temp(0, mpfr_get_prec(value), true);
  temp.set(*this);
  temp.sub(b);
  return temp;
}


inline refloat refloat::operator *(const refloat& b) const
{
  refloat temp(0, mpfr_get_prec(value), true);
  temp.set(*this);
  temp.mul(b);
  return temp;
}


inline refloat refloat::operator /(const refloat& b) const
{
  refloat temp(0, mpfr_get_prec(value), true);
  temp.set(*this);
  temp.div(b);
  return temp;
}


inline bool refloat::operator ==(const refloat& b) const
{
  return !(mpfr_cmp(value, b.value));
}


inline bool refloat::operator !=(const refloat& b) const
{
  return (mpfr_cmp(value, b.value));
}


inline bool refloat::operator <=(const refloat& b) const
{
  return ( mpfr_cmp(value, b.value) <= 0 );
}


inline bool refloat::operator >=(const refloat& b) const
{
  return ( mpfr_cmp(value, b.value) >= 0 );
}


inline bool refloat::operator <(const refloat& b) const
{
  return ( mpfr_cmp(value, b.value) < 0 );
}


inline bool refloat::operator >(const refloat& b) const
{
  return ( mpfr_cmp(value, b.value) > 0 );
}


inline refloat& refloat::operator +=(const refloat& b)
{
  add(b);
  return *this;
}


inline refloat& refloat::operator -=(const refloat& b)
{
  sub(b);
  return *this;
}


inline refloat& refloat::operator *=(const refloat& b)
{
  mul(b);
  return *this;
}


inline refloat& refloat::operator /=(const refloat& b)
{
  div(b);
  return *this;
}


inline refloat refloat::operator -() const
{
  refloat temp(0, mpfr_get_prec(value), true);
  temp.set(*this);
  temp.neg();
  return temp;
}



#endif
